package demo;

public class Demo {

	public static void main(String[] args) {
		long l = Demo.notDigui(5);
		System.out.println(l);
		System.out.println(Demo.diGui(5));
	}
	
	static long notDigui(int n){
		long result = 1;
		for (int i = 1; i <= n; i++) {
			result = result*i;
		}
		
		return result;
	}
	
	/**
	 * 递归调用阶乘
	 * @param n
	 * @return
	 */
	static long diGui(int n){
		if(n==1){
			return 1;
		}
		return diGui(n-1)*n;
	}
}
